package com.zhuidian.mothernote.activity;

import android.annotation.SuppressLint;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.base.decoration.LinearLayoutDecoration;
import com.base.listener.ItemClickListener;
import com.base.presenter.BasePresenter;
import com.zhuidian.mothernote.R;
import com.zhuidian.mothernote.adapter.QuestionDetailAdapter;
import com.zhuidian.mothernote.global.BaseActivity;
import com.zhuidian.mothernote.presenter.QuestionDetailPresenter;

public class QuestionDetailActivity extends BaseActivity {

    private RelativeLayout ll_title;
    private ImageView iv_arrow;
    private ImageView iv_dot;
    private RecyclerView recyclerView;
    private LinearLayout ll_bottom;
    private QuestionDetailAdapter adapter;
    private QuestionDetailPresenter questionDetailPresenter;
    private TextView tv_title;
    private TextView tv_content;
    private TextView tv_expend;
    private TextView tv_answer;
    private TextView tv_collect;
    private TextView tv_collect_question;
    private LinearLayout ll_red_bag;
    private TextView tv_money;
    private TextView tv_num;
    private TextView tv_red_setting;

    @Override
    protected int inflateMainLayoutId() {
        return R.layout.activity_question_detail;
    }

    @SuppressLint("WrongConstant")
    @Override
    protected void initView(View view) {
        setTopGone();
        ll_title = (RelativeLayout) view.findViewById(R.id.ll_title);
        iv_arrow = (ImageView) view.findViewById(R.id.iv_arrow);
        iv_dot = (ImageView) view.findViewById(R.id.iv_dot);
        recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
        ll_bottom = (LinearLayout) view.findViewById(R.id.ll_bottom);

        RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
        recyclerView.setHasFixedSize(true);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
        linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        recyclerView.setLayoutManager(linearLayoutManager);
        recyclerView.addItemDecoration(new LinearLayoutDecoration(context));
        adapter = new QuestionDetailAdapter(context);
        View  headerView= adapter.inflateHeaderView(R.layout.head_question_detail);

        tv_title = (TextView) headerView.findViewById(R.id.tv_title);
        tv_content = (TextView) headerView.findViewById(R.id.tv_content);
        tv_expend = (TextView) headerView.findViewById(R.id.tv_expend);
        tv_answer = (TextView) headerView.findViewById(R.id.tv_answer);
        tv_collect = (TextView) headerView.findViewById(R.id.tv_collect);
        tv_collect_question = (TextView) headerView.findViewById(R.id.tv_collect_question);

        ll_red_bag = (LinearLayout) headerView.findViewById(R.id.ll_red_bag);
        tv_money = (TextView) headerView.findViewById(R.id.tv_money);
        tv_num = (TextView) headerView.findViewById(R.id.tv_num);
        tv_red_setting = (TextView) headerView.findViewById(R.id.tv_red_setting);


        adapter.setOnClickListener(this);
        adapter.setItemClickListener(new ItemClickListener() {
            @Override
            public void onItemClick(View view, int position) {

            }
        });
        recyclerView.setAdapter(adapter);

    }

    @Override
    protected void setListener() {

    }

    @Override
    protected BasePresenter getPresenter() {
        questionDetailPresenter = new QuestionDetailPresenter();
        return questionDetailPresenter;
    }

    @Override
    public void onClick(View view) {
        super.onClick(view);
    }
}
